package edu.ensabap.matricula.dao;

import java.util.List;

import javax.sql.DataSource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
import org.springframework.stereotype.Repository;

import edu.ensabap.matricula.bean.TablaTipoDTO;
import edu.ensabap.matricula.constants.MySQlQuery;
import edu.ensabap.matricula.constants.RowMapperConstants;

@Repository
public class TablaTipoDAO {
	
	private SimpleJdbcTemplate simpleJdbcTemplate;
    private JdbcTemplate jdbcTemplate;
	private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
	
	@Autowired
	public void init(DataSource dataSource) {
		this.simpleJdbcTemplate = new SimpleJdbcTemplate(dataSource);
		this.jdbcTemplate=new JdbcTemplate(dataSource);
		this.namedParameterJdbcTemplate=new NamedParameterJdbcTemplate(dataSource);
		
	} 
	
	
	
	@SuppressWarnings("unchecked")
	public List<TablaTipoDTO> listar(){
		
				
		String sql =  MySQlQuery.LISTAR_TABLATIPO;
		
		return this.jdbcTemplate.query(sql, new RowMapperConstants.TablaTipoMapper());	
	}

}
